<template>
  <view class="approval-item">
    <CommonHeader>请假申请</CommonHeader>
    <view class="approval-content">
      <CommonInfo approvalType="请假" />
      <view class="input-area">
        <SelectList
          label="请假类型"
          :selectList="leaveTypeList"
          @getSelectData="getLeaveType"
        />
        <DateSelect label="开始时间" @getSelectDate="getLeaveStartTime" />
        <DateSelect label="结束时间" @getSelectDate="getLeaveOverTime" />
        <Textarea label="请假事由" @getInputData="getLeaveReason" />
      </view>
      <ApprovalButton
        :warn="warn"
        :approvalType="'leave'"
        :procInfo="{
          type: approval.leaveType,
          duration: String(
            Math.floor(
              ((approval.leaveOverTime - approval.leaveStartTime) /
                3600000 /
                24) *
                100
            ) / 100
          ),
          startTime: String(approval.leaveStartTime),
          endTime: String(approval.leaveOverTime),
          leaveReason: approval.leaveReason,
        }"
      />
    </view>
    <van-toast id="van-toast" />
  </view>
</template>
<script src="./script.js"></script>
<style lang="less" src="./style.less"></style>
